home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / himath.zip / HIMATH.DOC < prev    next >
Text File  |  1991-10-04  |  41KB  |  535 lines

  1.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  2.      Documentation Page 1
  3.  
  4.      +-----------------+-----------------+-----------------+-----------------+
  5.      |TYPE             |SIMPLE           |3d VECTOR        |COMPLEX          |
  6.      |PRECISION        |DOUBLE           |DOUBLE           |DOUBLE           |
  7.      |RETURNS          |DOUBLE           |VRect            |XRect            |
  8.      +-----------------+-----------------+-----------------+-----------------+
  9.  
  10.      +-----------------------------------------------------------------------+
  11.      |TRIGINOMETRIC ROUTINES                                                 |
  12.      +-----------------+-----------------+-----------------+-----------------+
  13.      |ArcCosine        |ACOS#          2 |                 |                 |
  14.      |ArcSine          |ASIN#          2 |                 |                 |
  15.      |ArcTangent       |ATAN2#         2 |                 |                 |
  16.      |Triangle Solution|TriangleSolve  3 |                 |                 |
  17.      +-----------------+-----------------+-----------------+-----------------+
  18.  
  19.      +-----------------------------------------------------------------------+
  20.      |TRANSLATION ROUTINES                                                   |
  21.      +-----------------+-----------------+-----------------+-----------------+
  22.      |ConvertFromPolar |                 |                 |XCnvP          8 |
  23.      |ConvertFromRect  |                 |                 |XCnvR          8 |
  24.      |Magnitude        |                 |                 |XMag#          8 |
  25.      |Angle            |                 |                 |XAng#          8 |
  26.      |Real             |                 |                 |XReal#         9 |
  27.      |Imaginary        |                 |                 |XImag#         9 |
  28.      |Fmt As Polar Str |                 |                 |XFmtP$         9 |
  29.      |Fmt As Rect Str  |                 |VFmtR$         7 |XFmtR$         9 |
  30.      +-----------------+-----------------+-----------------+-----------------+
  31.  
  32.      +-----------------------------------------------------------------------+
  33.      |ARITHMETIC ROUTINES                                                    |
  34.      +-----------------+-----------------+-----------------+-----------------+
  35.      |ADDITION         |+                |VAdd           7 |XAdd          10 |
  36.      |SUBTRACTION      |-                |VSub           7 |XSub          10 |
  37.      |MULTIPLICATION   |*                |VmltX          7 |XMlt          10 |
  38.      |                 |                 |VMltD#         7 |                 |
  39.      |DIVISION         |/                |                 |XDiv          10 |
  40.      |POWERS & ROOTS   |^                |                 |XPwr          10 |
  41.      |CONJUGATE        |na               |                 |XCnj          11 |
  42.      |INVERSE          |1/X              |                 |XInv          11 |
  43.      +-----------------+-----------------+-----------------+-----------------+
  44.  
  45.      +-----------------------------------------------------------------------+
  46.      |MATRIX OPERATIONS                                                      |
  47.      +-----------------+-----------------+-----------------+-----------------+
  48.      |Add              |MtxAdd         4 |                 |XMtxAdd       12 |
  49.      |Subtract         |MtxSub         4 |                 |XMtxSub       12 |
  50.      |Solve Simul Eq #1|MtxCoeff       4 |                 |XMtxCoeff     13 |
  51.      |Solve Simul Eq #2|MtxCoeffa      5 |                 |XMtxCoeffa    13 |
  52.      |Copy             |MtxCopy        5 |                 |XMtxCopy      13 |
  53.      |Determinant      |MtxDet         5 |                 |XMtxDet       14 |
  54.      |Invert           |MtxInv         5 |                 |XMtxInv       14 |
  55.      |Scaler Product   |MtxMltS        6 |                 |XMtxMltS      14 |
  56.      |Cross Product    |MtxMltX        6 |                 |XMtxMltX      14 |
  57.      +-----------------+-----------------+-----------------+-----------------+
  58.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  59.      Documentation Page 2
  60.  
  61.      +-----------------------------------------------------------------------+
  62.      | DOUBLE PRECISION INVERSE TRIGINOMETRIC FUNCTIONS                      |
  63.      +-----------------------------------------------------------------------+
  64.      +-----------------------------------------------------------------------+
  65.      |       Function: ArcCosine                                             |
  66.      |        Example: Theta# = ACOS#(x#)                                    |
  67.      |     Parameters: -1 <= x# <=+1                                         |
  68.      |        Returns: Angle in Radians. 0 <= Theta <= Pi                    |
  69.      |           Note: Two Quadrants Only.                                   |
  70.      +-----------------------------------------------------------------------+
  71.      +-----------------------------------------------------------------------+
  72.      |       Function: ArcSine                                               |
  73.      |        Example: Theta# = ASIN#(y#)                                    |
  74.      |     Parameters: -1 <= y# <=+1                                         |
  75.      |        Returns: Angle in Radians. -Pi/2 <= Theta <= Pi/2              |
  76.      |           Note: Two Quadrants Only.                                   |
  77.      +-----------------------------------------------------------------------+
  78.      +-----------------------------------------------------------------------+
  79.      |       Function: ArcTangent                                            |
  80.      |        Example: Theta# = ATAN2#(x#, y#)                               |
  81.      |     Parameters: 1. "x" axis value.                                    |
  82.      |                 2. "y" axis value.                                    |
  83.      |        Returns: Angle in Radians. 0 <= Theta <= 2*Pi                  |
  84.      |           Note: All Four Quadrants. if x=0, function will return a    |
  85.      |                 value of +Pi/2 or -Pi/2 depending upon the value of   |
  86.      |                 y#.                                                   |
  87.      +-----------------------------------------------------------------------+
  88.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  89.      Documentation Page 3
  90.  
  91.      +-----------------------------------------------------------------------+
  92.      | DOUBLE PRECISION TRIANGLE SOLUTIONS                                   |
  93.      +-----------------------------------------------------------------------+
  94.      +-----------------------------------------------------------------------+
  95.      |     Subroutine: Triangle Solution                                     |
  96.      |        Example: TriangleSolve PType$,p1#,p2#,p3#,A#(),S#(),Sols%      |
  97.      |     Parameters: 1. Problem Type String. Can Be any of the following:  |
  98.      |                                                                       |
  99.      |                      Problem      Parm    Parm     Parm               |
  100.      |                         Type      1 is     2 is     3 is              |
  101.      |                     --------    ------   ------   ------              |
  102.      |                        "SSS"    Side-A   Side-B   Side-C              |
  103.      |                        "SAS"    Side-A  Angle-c   Side-B              |
  104.      |                        "ASA"   Angle-a   Side-C  Angle-b              |
  105.      |                        "AAS"   Angle-a  Angle-b   Side-A              |
  106.      |                        "SSA"    Side-A   Side-B  Angle-a              |
  107.      |                                                                       |
  108.      |                 2. Parameter #1 (see chart)                           |
  109.      |                 3. Parameter #2 (see chart)                           |
  110.      |                 4. Parameter #3 (see chart)                           |
  111.      |                 5. One dimension Array, DIM A#(3), that will receive  |
  112.      |                 the calculated  angles                                |
  113.      |                 6. One dimension Array, DIM S#(3), that will receive  |
  114.      |                 the calculated sides.                                 |
  115.      |                 7. Returns 0 if there is no solution, 1 if there is 1 |
  116.      |                 solution, or 2 if there are 2 solutions. ALSO.... Set |
  117.      |                 parameter 7 to 2 to retreive the second solution.     |
  118.      +-----------------------------------------------------------------------+
  119.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  120.      Documentation Page 4
  121.  
  122.      +-----------------------------------------------------------------------+
  123.      | DOUBLE PRECISION MATRIX COMPUTATIONS                                  |
  124.      +-----------------------------------------------------------------------+
  125.      +-----------------------------------------------------------------------+
  126.      |     Subroutine: Matrix Addition A+B=C                                 |
  127.      |        Example: MtxAdd MtxErr%, A#(), B#(), C#()                      |
  128.      |     Parameters: 1. Returns Non-Zero Value if arrays are not           |
  129.      |                 compatible                                            |
  130.      |                 2. Two Dimension Array. Input "A"                     |
  131.      |                 3. Two Dimension Array. Input "B"                     |
  132.      |                 4. Two Dimension Array. Resultant.                    |
  133.      |          Notes: Arrays must be defined prior to use.                  |
  134.      +-----------------------------------------------------------------------+
  135.      +-----------------------------------------------------------------------+
  136.      |     Subroutine: Matrix Subtraction A-B=C                              |
  137.      |        Example: MtxSub MtxErr%, A#(), B#(), C#()                      |
  138.      |     Parameters: 1. Returns Non-Zero Value if arrays are not           |
  139.      |                 compatible                                            |
  140.      |                 2. Two Dimension Array. Input "A"                     |
  141.      |                 3. Two Dimension Array. Input "B"                     |
  142.      |                 4. Two Dimension Array. Resultant.                    |
  143.      |          Notes: Arrays must be defined prior to use.                  |
  144.      +-----------------------------------------------------------------------+
  145.      +-----------------------------------------------------------------------+
  146.      |     Subroutine: Linear System Solution #1                             |
  147.      |        Example: MtxCoeff MtxErr%, Mtx#(), Vctr#(), Coeff#()           |
  148.      |     Parameters: 1. Returns Non-Zero Value if arrays are not           |
  149.      |                 compatible or if matrix is singular.                  |
  150.      |                 2. Two Dimension Array. Input. Coefficients of the    |
  151.      |                 equations of the system.                              |
  152.      |                 3. One Dimension Array. Input. The column vector.     |
  153.      |                 4. One Dimension Array. Output. Solution to the       |
  154.      |                 system of linear equations.                           |
  155.      |          Notes: Arrays must be defined prior to use. The original     |
  156.      |                 matrix is not altered. Array Mtx#() must be square    |
  157.      |                 and Vctr#() and Coeff#() must be the same size as one |
  158.      |                 dimension as Mtx#(). ie n=3:DIM Mtx#(n,n), Vctr#(n),  |
  159.      |                 Coeff#(n)                                             |
  160.      +-----------------------------------------------------------------------+
  161.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  162.      Documentation Page 5
  163.  
  164.      +-----------------------------------------------------------------------+
  165.      |     Subroutine: Linear System Solution #2                             |
  166.      |        Example: MtxCoeffA MtxErr%, Mtx#()                             |
  167.      |     Parameters: 1. Returns Non-Zero Value if arrays are not           |
  168.      |                 compatible or if matrix is singular.                  |
  169.      |                 2. Two Dimension Array. Input. Coefficients of the    |
  170.      |                 equations of the system with the column vector entered|
  171.      |                 into column n+1. The solution to the system of linear |
  172.      |                 equations. is returned in column n+1.                 |
  173.      |          Notes: Array must be defined prior to use. The original      |
  174.      |                 matrix IS TRASHED !. This routine is faster than      |
  175.      |                 MtxCoeff because it makes no effort to preserve the   |
  176.      |                 original array or place the results in a seperate     |
  177.      |                 array. Array Mtx#() must be rectangular with one more |
  178.      |                 column than rows n=3 : DIM Mtx#(n,n+1)                |
  179.      +-----------------------------------------------------------------------+
  180.      +-----------------------------------------------------------------------+
  181.      |     Subroutine: Duplicate An Array (Matrix)                           |
  182.      |        Example: MtxCopy MtxErr%, Src#(), Dst#()                       |
  183.      |     Parameters: 1. Returns Non-Zero Value if arrays are not           |
  184.      |                 compatible.                                           |
  185.      |                 2. Two Dimensional Array. Source.                     |
  186.      |                 3. Two Dimensional Array. Destination.                |
  187.      |          Notes: Arrays must be defined prior to use. They may be      |
  188.      |                 either square or rectangular.                         |
  189.      +-----------------------------------------------------------------------+
  190.      +-----------------------------------------------------------------------+
  191.      |       Function: Determinate of a Matrix.                              |
  192.      |        Example: Determinate# = MtxDet#(MtxErr%, Mtx#())               |
  193.      |     Parameters: 1. Returns Non-zero value if array is singular.       |
  194.      |                 2. Two Dimensional Square Matrix Array.               |
  195.      |        Returns: Determinate of the Matrix.                            |
  196.      +-----------------------------------------------------------------------+
  197.      +-----------------------------------------------------------------------+
  198.      |     Subroutine: Invert Matrix                                         |
  199.      |        Example: MtxInv MtxErr%, A#(), C#()                            |
  200.      |     Parameters: 1. Returns Non-zero value if array is singular.       |
  201.      |                 2. Two Dimensional Matrix Array To Invert.            |
  202.      |                 3. Two Dimensional Matrix Array To Receive Inverted   |
  203.      |                 Matrix                                                |
  204.      +-----------------------------------------------------------------------+
  205.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  206.      Documentation Page 6
  207.  
  208.      +-----------------------------------------------------------------------+
  209.      |     Subroutine: Scalar Product of a Matrix                            |
  210.      |        Example: MtxMltS MtxErr%, A#(), B#, C#()                       |
  211.      |     Parameters: 1. Returns Non-zero value if arrays are incompatible. |
  212.      |                 2. Two Dimensional Matrix Array To Scale.             |
  213.      |                 3. Scalar                                             |
  214.      |                 4. Two Dimensional Matrix Array To Receive Scalar     |
  215.      |                 Product.                                              |
  216.      +-----------------------------------------------------------------------+
  217.      +-----------------------------------------------------------------------+
  218.      |     Subroutine: Cross Product of a Matrix                             |
  219.      |        Example: MtxMltX MtxErr%, A#(), B#(), C#()                     |
  220.      |     Parameters: 1. Returns Non-zero value if arrays are incompatible. |
  221.      |                 2. Two Dimensional Matrix Array. "A"                  |
  222.      |                 3. Two Dimensional Matrix Array. "B"                  |
  223.      |                 4. Two Dimensional Matrix Array To Receive Cross      |
  224.      |                 Product (AxB).                                        |
  225.      +-----------------------------------------------------------------------+
  226.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  227.      Documentation Page 7
  228.  
  229.      +-----------------------------------------------------------------------+
  230.      | THREE DIMENSIONAL VECTOR ARITHMETIC                                   |
  231.      +-----------------------------------------------------------------------+
  232.      |                  TYPE VRect                                           |
  233.      |                    x AS DOUBLE                                        |
  234.      |                    y AS DOUBLE                                        |
  235.      |                    z AS DOUBLE                                        |
  236.      |                  END TYPE                                             |
  237.      +-----------------------------------------------------------------------+
  238.      +-----------------------------------------------------------------------+
  239.      |     Subroutine: 3d Vector Addition                                    |
  240.      |        Example: VAdd Op1 AS VRect, Op2 AS VRect, Result AS VRect      |
  241.      |     Parameters: 1. Input First Vector "A"                             |
  242.      |                 2. Input Second Vector "B"                            |
  243.      |                 3. Returns Sum of Vectors (A+B)                       |
  244.      +-----------------------------------------------------------------------+
  245.      +-----------------------------------------------------------------------+
  246.      |     Subroutine: 3d Vector Subtraction                                 |
  247.      |        Example: VSub Op1 AS VRect, Op2 AS VRect, Result AS VRect      |
  248.      |     Parameters: 1. Input First Vector "A"                             |
  249.      |                 2. Input Second Vector "B"                            |
  250.      |                 3. Returns Difference of Vectors (A+B)                |
  251.      +-----------------------------------------------------------------------+
  252.      +-----------------------------------------------------------------------+
  253.      |     Subroutine: 3d Vector Cross Product                               |
  254.      |        Example: VMltX Op1 AS VRect, Op2 AS VRect, Result AS VRect     |
  255.      |     Parameters: 1. Input First Vector "A"                             |
  256.      |                 2. Input Second Vector "B"                            |
  257.      |                 3. Returns Cross Product of Vectors (AxB)             |
  258.      +-----------------------------------------------------------------------+
  259.      +-----------------------------------------------------------------------+
  260.      |     Subroutine: 3d Vector Dot Product                                 |
  261.      |        Example: dp# = VMltD#(Op1 AS VRect, Op2 AS VRect)              |
  262.      |     Parameters: 1. Input First Vector "A"                             |
  263.      |                 2. Input Second Vector "B"                            |
  264.      |        Returns: 3. Returns Dot Product of Vectors (A*B)               |
  265.      +-----------------------------------------------------------------------+
  266.      +-----------------------------------------------------------------------+
  267.      |       Function: Format 3d Vector for Printing                         |
  268.      |        Example: PRINT VFmtR$(Op1 AS VRect)                            |
  269.      |     Parameters: 1. Vector                                             |
  270.      |        Returns: 2. String similar to  +45.7x-223.345y+.051z           |
  271.      |          Notes: Crude, but helps debugging.                           |
  272.      +-----------------------------------------------------------------------+
  273.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  274.      Documentation Page 8
  275.  
  276.      +-----------------------------------------------------------------------+
  277.      | COMPLEX NUMBER CONVERSION AND FORMATTING                              |
  278.      +-----------------------------------------------------------------------+
  279.      |                 TYPE XRect                                            |
  280.      |                   x AS DOUBLE                                         |
  281.      |                   y AS DOUBLE                                         |
  282.      |                 END TYPE                                              |
  283.      +-----------------------------------------------------------------------+
  284.      +-----------------------------------------------------------------------+
  285.      |     Subroutine: Convert Complex Number in Polar Format to User Type.  |
  286.      |        Example: XCnvP r#, t#, Result AS XRect                         |
  287.      |     Parameters: 1. Magnitude (radius) of number                       |
  288.      |                 2. Angle (theta) of number in radians                 |
  289.      |                 3. Returns number in User Type to be used in          |
  290.      |                 calculations.                                         |
  291.      |          Notes: Can also be used for a quick and dirty polar to       |
  292.      |                 rectangular conversion.                               |
  293.      +-----------------------------------------------------------------------+
  294.      +-----------------------------------------------------------------------+
  295.      |     Subroutine: Convert Complex Number in Rectangular Format to User  |
  296.      |                 Type.                                                 |
  297.      |        Example: XCnvR i#, j#, Result AS XRect                         |
  298.      |     Parameters: 1. Real portion of number                             |
  299.      |                 2. Imaginary portion of number                        |
  300.      |                 3. Returns number in User Type to be used in          |
  301.      |                 calculations.                                         |
  302.      |          Notes: Provided only for consistancy. The user type is       |
  303.      |                 already in rectangular format. The same effect can be |
  304.      |                 had by: Result.x = i# : Result.y = j#                 |
  305.      +-----------------------------------------------------------------------+
  306.      +-----------------------------------------------------------------------+
  307.      |       Function: Find Angle of Complex Number                          |
  308.      |        Example: Degrees# = XAng#(Op1 AS XRect) * 180 / Pi             |
  309.      |     Parameters: 1. Complex Number                                     |
  310.      |        Returns: Angle of Complex Number (in radians)                  |
  311.      +-----------------------------------------------------------------------+
  312.      +-----------------------------------------------------------------------+
  313.      |       Function: Find Magnitude of Complex Number                      |
  314.      |        Example: Magnitude# = XMag#(Op1 AS XRect)                      |
  315.      |     Parameters: 1. Complex Number                                     |
  316.      |        Returns: Magnitude of Complex Number                           |
  317.      +-----------------------------------------------------------------------+
  318.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  319.      Documentation Page 9
  320.  
  321.      +-----------------------------------------------------------------------+
  322.      |       Function: Find Real Portion of Complex Number                   |
  323.      |        Example: Real# = XReal#(Op1 AS XRect)                          |
  324.      |     Parameters: 1. Complex Number                                     |
  325.      |        Returns: Imaginary Portion of Complex Number                   |
  326.      |           Note: Provided only for consistancy. The user type is       |
  327.      |                 already in rectangular format. The same effect can be |
  328.      |                 had by: Real# = Op1.x                                 |
  329.      +-----------------------------------------------------------------------+
  330.      +-----------------------------------------------------------------------+
  331.      |       Function: Find Imaginary Portion of Complex Number              |
  332.      |        Example: Unreal# = XImag#(Op1 AS XRect)                        |
  333.      |     Parameters: 1. Complex Number                                     |
  334.      |        Returns: Imaginary Portion of Complex Number                   |
  335.      |           Note: Provided only for consistancy. The user type is       |
  336.      |                 already in rectangular format. The same effect can be |
  337.      |                 had by: Unreal# = Op1.y                               |
  338.      +-----------------------------------------------------------------------+
  339.      +-----------------------------------------------------------------------+
  340.      |       Function: Format Complex Number for Printing (polar format)     |
  341.      |        Example: PRINT XFmtP$(Op1 AS XRect)                            |
  342.      |     Parameters: 1. Complex Number                                     |
  343.      |        Returns: 2. String similar to  +45.7<-223.345 Deg              |
  344.      |          Notes: Crude, but helps debugging.                           |
  345.      +-----------------------------------------------------------------------+
  346.      +-----------------------------------------------------------------------+
  347.      |       Function: Format Complex Number for Printing (rectangular       |
  348.      |                 format)                                               |
  349.      |        Example: PRINT XFmtR$(Op1 AS XRect)                            |
  350.      |     Parameters: 1. Complex Number                                     |
  351.      |        Returns: 2. String similar to  +45.7-223.345j                  |
  352.      |          Notes: Crude, but helps debugging.                           |
  353.      +-----------------------------------------------------------------------+
  354.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  355.      Documentation Page 10
  356.  
  357.      +-----------------------------------------------------------------------+
  358.      | COMPLEX NUMBER ARITHMETIC                                             |
  359.      +-----------------------------------------------------------------------+
  360.      |                 TYPE XRect                                            |
  361.      |                   x AS DOUBLE                                         |
  362.      |                   y AS DOUBLE                                         |
  363.      |                 END TYPE                                              |
  364.      +-----------------------------------------------------------------------+
  365.      +-----------------------------------------------------------------------+
  366.      |     Subroutine: Add Two Complex Numbers                               |
  367.      |        Example: XAdd Op1 AS XRect, Op2 AS XRect, Result AS XRect      |
  368.      |     Parameters: 1. Complex Number "A"                                 |
  369.      |                 2. Complex Number "B"                                 |
  370.      |                 3. Returns Complex Number (A+B)                       |
  371.      +-----------------------------------------------------------------------+
  372.      +-----------------------------------------------------------------------+
  373.      |     Subroutine: Subtract Two Complex Numbers                          |
  374.      |        Example: XSub Op1 AS XRect, Op2 AS XRect, Result AS XRect      |
  375.      |     Parameters: 1. Complex Number "A"                                 |
  376.      |                 2. Complex Number "B"                                 |
  377.      |                 3. Returns Complex Number (A-B)                       |
  378.      +-----------------------------------------------------------------------+
  379.      +-----------------------------------------------------------------------+
  380.      |     Subroutine: Multiply Two Complex Numbers                          |
  381.      |        Example: XMlt Op1 AS XRect, Op2 AS XRect, Result AS XRect      |
  382.      |     Parameters: 1. Complex Number "A"                                 |
  383.      |                 2. Complex Number "B"                                 |
  384.      |                 3. Returns Complex Number (AxB)                       |
  385.      +-----------------------------------------------------------------------+
  386.      +-----------------------------------------------------------------------+
  387.      |     Subroutine: Divide Two Complex Numbers                            |
  388.      |        Example: XDiv Op1 AS XRect, Op2 AS XRect, Result AS XRect      |
  389.      |     Parameters: 1. Complex Number "A"                                 |
  390.      |                 2. Complex Number "B"                                 |
  391.      |                 3. Returns Complex Number (A/B)                       |
  392.      +-----------------------------------------------------------------------+
  393.      +-----------------------------------------------------------------------+
  394.      |     Subroutine: Raise a Complex Number to a real power                |
  395.      |        Example: XPwr Op1 AS XRect, Op2#, Result AS XRect              |
  396.      |     Parameters: 1. Complex Number "A"                                 |
  397.      |                 2. Real Number "B"                                    |
  398.      |                 3. Returns Complex Number (A^B)                       |
  399.      +-----------------------------------------------------------------------+
  400.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  401.      Documentation Page 11
  402.  
  403.      +-----------------------------------------------------------------------+
  404.      |     Subroutine: Find the conjugate of a Complex Number                |
  405.      |        Example: XCnj Op1 AS XRect, Result AS XRect                    |
  406.      |     Parameters: 1. Complex Number "A"                                 |
  407.      |                 2. Returns Complex Number conj(A)                     |
  408.      +-----------------------------------------------------------------------+
  409.      +-----------------------------------------------------------------------+
  410.      |     Subroutine: Find the inverse of a Complex Number                  |
  411.      |        Example: XInv (Op1 AS XRect, Result AS XRect)                  |
  412.      |     Parameters: 1. Complex Number "A"                                 |
  413.      |                 2. Returns Complex Number (1/A)                       |
  414.      +-----------------------------------------------------------------------+
  415.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  416.      Documentation Page 12
  417.  
  418.      +-----------------------------------------------------------------------+
  419.      | COMPLEX MATRIX ARITHMETIC                                             |
  420.      +-----------------------------------------------------------------------+
  421.      |                 TYPE XRect                                            |
  422.      |                   x AS DOUBLE                                         |
  423.      |                   y AS DOUBLE                                         |
  424.      |                 END TYPE                                              |
  425.      +-----------------------------------------------------------------------+
  426.      +-----------------------------------------------------------------------+
  427.      |     Subroutine: Complex Number Matrix Addition (A+B=C)                |
  428.      |        Example: XMtxAdd MErr%,A() AS XRect,B() AS XRect,C() AS XRect  |
  429.      |     Parameters: 1. Returns Non-Zero Value if Complex Nbr Arrays are   |
  430.      |                 not compatible                                        |
  431.      |                 2. Two Dimension Complex Nbr Array. Input "A"         |
  432.      |                 3. Two Dimension Complex Nbr Array. Input "B"         |
  433.      |                 4. Two Dimension Complex Nbr Array. Resultant.        |
  434.      |          Notes: Arrays must be defined prior to use.                  |
  435.      +-----------------------------------------------------------------------+
  436.      +-----------------------------------------------------------------------+
  437.      |     Subroutine: Complex Number Matrix Subtraction (A-B=C)             |
  438.      |        Example: XMtxSub MErr%,A() AS XRect,B() AS XRect,C() AS XRect  |
  439.      |     Parameters: 1. Returns Non-Zero Value if Complex Nbr Arrays are   |
  440.      |                 not compatible                                        |
  441.      |                 2. Two Dimension Complex Nbr Array. Input "A"         |
  442.      |                 3. Two Dimension Complex Nbr Array. Input "B"         |
  443.      |                 4. Two Dimension Complex Nbr Array. Resultant.        |
  444.      |          Notes: Arrays must be defined prior to use.                  |
  445.      +-----------------------------------------------------------------------+
  446.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  447.      Documentation Page 13
  448.  
  449.      +-----------------------------------------------------------------------+
  450.      |     Subroutine: Complex Number Linear System Solution #1              |
  451.      |        Example: XMtxCoeff MErr%,Mtx() AS XRect,Vctr() AS XRect,Coef() |
  452.      |     Parameters: 1. Returns Non-Zero Value if Complex Nbr Arrays are   |
  453.      |                 not compatible or if matrix is singular.              |
  454.      |                 2. Two Dimension Complex Nbr Array. Input.            |
  455.      |                 Coefficients of the equations of the system.          |
  456.      |                 3. One Dimension Complex Nbr Array. Input. The column |
  457.      |                 vector.                                               |
  458.      |                 4. One Dimension Complex Nbr Array. Output. Solution  |
  459.      |                 to the system of linear equations.                    |
  460.      |          Notes: Arrays must be defined prior to use. The original     |
  461.      |                 matrix is not altered. Complex Nbr Array Mtx() must   |
  462.      |                 be square and Vctr() and Coeff() must be the same     |
  463.      |                 size as one dimension as Mtx(). ie. n=3:DIM Mtx(n,n)  |
  464.      |                 as XRect, Vctr(n) as XRect, Coeff(n) as XRect         |
  465.      +-----------------------------------------------------------------------+
  466.      +-----------------------------------------------------------------------+
  467.      |     Subroutine: Complex Number Linear System Solution #2              |
  468.      |        Example: XMtxCoeffA (MErr%, Mtx() AS XRect)                    |
  469.      |     Parameters: 1. Returns Non-Zero Value if Complex Nbr Arrays are   |
  470.      |                 not compatible or if matrix is singular.              |
  471.      |                 2. Two Dimension Complex Nbr Array. Input.            |
  472.      |                 Coefficients of the equations of the system with the  |
  473.      |                 column vector entered into column n+1. The solution   |
  474.      |                 to the system of linear equations. is returned in     |
  475.      |                 column n+1.                                           |
  476.      |          Notes: Array must be defined prior to use. The original      |
  477.      |                 matrix IS TRASHED !. This routine is faster than      |
  478.      |                 MtxCoeff because it makes no effort to preserve the   |
  479.      |                 original Complex Nbr Array or place the results in a  |
  480.      |                 seperate array. Complex Nbr Array Mtx() must be       |
  481.      |                 rectangular with one more column than rows n=3 : DIM  |
  482.      |                 Mtx(n,n+1) as XRect                                   |
  483.      +-----------------------------------------------------------------------+
  484.      +-----------------------------------------------------------------------+
  485.      |     Subroutine: Duplicate Complex Number Matrix                       |
  486.      |        Example: XMtxCopy MErr%, Src() AS XRect, Dst() AS XRect        |
  487.      |     Parameters: 1. Returns Non-Zero Value if Complex Nbr Arrays are   |
  488.      |                 not compatible.                                       |
  489.      |                 2. Two Dimensional Complex Nbr Array. Source.         |
  490.      |                 3. Two Dimensional Complex Nbr Array. Destination.    |
  491.      |          Notes: Arrays must be defined prior to use. They may be      |
  492.      |                 either square or rectangular.                         |
  493.      +-----------------------------------------------------------------------+
  494.      "HIMATH" Library Routines for QuickBASIC   (c)1991 Kevin T. Jorgensen
  495.      Documentation Page 14
  496.  
  497.      +-----------------------------------------------------------------------+
  498.      |     Subroutine: Find Determinant of Complex Number Matrix             |
  499.      |        Example: XMtxDet MErr%, XMtx() AS XRect                        |
  500.      |     Parameters: 1. Returns Non-zero value if Complex Nbr Array is     |
  501.      |                 singular.                                             |
  502.      |                 2. Two Dimensional Square Matrix Complex Nbr Array.   |
  503.      |          Notes: Determinant is returned as element 0,0 of the matrix. |
  504.      +-----------------------------------------------------------------------+
  505.      +-----------------------------------------------------------------------+
  506.      |     Subroutine: Invert Complex Number Matrix                          |
  507.      |        Example: XMtxInv MErr%, A() AS XRect, Mtx() AS XRect           |
  508.      |     Parameters: 1. Returns Non-zero value if Complex Nbr Array is     |
  509.      |                 singular.                                             |
  510.      |                 2. Two Dimensional Matrix Complex Nbr Array To        |
  511.      |                 Invert.                                               |
  512.      |                 3. Two Dimensional Matrix Complex Nbr Array To        |
  513.      |                 Receive Inverted Matrix                               |
  514.      +-----------------------------------------------------------------------+
  515.      +-----------------------------------------------------------------------+
  516.      |     Subroutine: Complex Number Matrix Scalar Product                  |
  517.      |        Example: XMtxMltS MErr%,A() AS XRect,B AS XRect,C() AS XRect   |
  518.      |     Parameters: 1. Returns Non-zero value if Complex Nbr Arrays are   |
  519.      |                 incompatible.                                         |
  520.      |                 2. Two Dimensional Matrix Complex Nbr Array To Scale. |
  521.      |                 3. Scalar                                             |
  522.      |                 4. Two Dimensional Matrix Complex Nbr Array To        |
  523.      |                 Receive Scalar Product.                               |
  524.      +-----------------------------------------------------------------------+
  525.      +-----------------------------------------------------------------------+
  526.      |     Subroutine: Complex Number Matrix Cross Product                   |
  527.      |        Example: XMtxMltX MErr%,A() AS XRect,B() AS XRect,C() AS XRect |
  528.      |     Parameters: 1. Returns Non-zero value if Complex Nbr Arrays are   |
  529.      |                 incompatible.                                         |
  530.      |                 2. Two Dimensional Matrix Complex Nbr Array. "A"      |
  531.      |                 3. Two Dimensional Matrix Complex Nbr Array. "B"      |
  532.      |                 4. Two Dimensional Matrix Complex Nbr Array To        |
  533.      |                 Receive Cross Product (AxB).                          |
  534.      +-----------------------------------------------------------------------+
  535.